home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10043 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: news.cuny.edu!news
  2. From: Christopher Vickery <vickery@babbage.cs.qc.edu>
  3. Newsgroups: comp.lang.c++
  4. Subject: iostream error recovery question
  5. Date: Tue, 05 Mar 1996 16:10:13 -0500
  6. Organization: Queens College of CUNY
  7. Message-ID: <313CADB5.39AF@babbage.cs.qc.edu>
  8. NNTP-Posting-Host: cv_home.cs.qc.edu
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0 (Win16; I)
  13.  
  14. If x is an int, I execute "cin >> x;", and the user types a letter
  15. instead of a number, ios::failbit gets set, and trying to do another
  16. stream extraction fails.  Executing cin.clear() resets the
  17. ios::failbit and sets ios::goodbit, and I would expect to be able
  18. to use cin again.  However using both g++ on Unix and Borland C++
  19. I am unable to read anything from cin once the user types in a letter.
  20. What does one do to recover?    
  21. -- 
  22. Dr. Christopher Vickery, Computer Science Department,
  23. Queens College of CUNY
  24. Do you know about the League for Programming Freedom?
  25. Contact http://www.lpf.org or lpf@uunet.uu.net for more information.
  26.